package com.example.lotterysystem.mapper;

import com.example.lotterysystem.pojo.dataobject.WinningRecordDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface WinningRecordMapper {

    int batchInsert(@Param("items") List<WinningRecordDO> winningRecordDOList);

    List<WinningRecordDO> selectByActivityId(@Param("activityId") Long activityId);

    int count(@Param("activityId") Long activityId,
              @Param("prizeId") Long prizeId);

    /**
     * 删除 活动 或 奖品下的中奖记录
     * 如果 奖品不存在就直接删除活动，如果奖品存在就删奖品下的记录
     * @param activityId
     * @param prizeId
     */
    void deleteRecords(@Param("activityId") Long activityId,
                       @Param("prizeId") Long prizeId);

    List<WinningRecordDO> selectByActivityIdOrPrizeId(@Param("activityId") Long activityId,
                                                      @Param("prizeId") Long prizeId);
}
